﻿<Window x:Class="CncConvProg.View.Dialog.MachinesDialogView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        Title="EditWorkView" MinHeight="300" MinWidth="600"
        WindowStyle="ToolWindow"
        WindowState="Normal"
        Width="600"
        Height="400"
        WindowStartupLocation="CenterScreen"
        >
    <Grid >
        <Grid.RowDefinitions>
            <RowDefinition Height="671*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.362*" MinWidth="150" />
            <ColumnDefinition Width="0.638*" MinWidth="150" />
        </Grid.ColumnDefinitions>

        <!-- Lista Utensili -->
        <Border x:Name="Colonna_SX" Grid.RowSpan="1">
            <DockPanel>
                <Menu DockPanel.Dock="Top" HorizontalAlignment="Left">
                    <MenuItem Header="Add Machine"  >
                        <MenuItem Header="Vertical Mill" Command="{Binding AddMachineCmd}"  CommandParameter="0"/>
                    </MenuItem>
                </Menu>
                <ListView ItemsSource="{Binding Path=Machines}" SelectionMode="Single" 
                          SelectedItem="{Binding Path=SelectedMachine}" Margin="5"
                          >
                    <ListView.View>
                        <GridView>
                            <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Path=MachineName}" Width="130"/>
                            <GridViewColumn Width="50">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <Button Content="X" 
                                        Command="{Binding DataContext.DelMachineCmd, RelativeSource={RelativeSource AncestorLevel=1, AncestorType={x:Type Window}, Mode=FindAncestor}}"
                                        CommandParameter="{Binding}"
                                                />
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                        </GridView>
                    </ListView.View>
                </ListView>
            </DockPanel>
        </Border>

        <GridSplitter Width="2" Height="250"  />
        <!-- Dettagli Utensile -->
        <Border x:Name="Colonna_DX" Grid.Column="1" Margin="2,5,5,5" BorderThickness="2" Grid.RowSpan="1" DataContext="{Binding Path=SelectedMachine}">
            <DockPanel>

                <TextBlock HorizontalAlignment="Left" DockPanel.Dock="Top"
                               Width="250" Text="{Binding Path=MachineName}" FontSize="24" Margin="10,10,0,10" />
                <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
                    <TextBlock Text="Machine Name : "/>
                    <TextBox Text="{Binding Path=MachineName}" MinWidth="100"/>
                </StackPanel>

              
            </DockPanel>
        </Border>

        <StackPanel Orientation="Horizontal" Grid.Row="3" HorizontalAlignment="Right" Grid.ColumnSpan="2" >
            <Button Content="Annulla" Width="100" Margin="5" Click="Button_Click_1" />
            <Button Content="Ok" Width="100" Margin="5" Click="Button_Click" />
        </StackPanel>
    </Grid>
</Window>
